﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentValidation;

namespace Microhard.Permission.Validator
{
    public class RoleValidator : AbstractValidator<Microhard.Permission.Models.Role>
    {
        public RoleValidator()
        {
            RuleSet("Insert", () =>
            {
                RuleFor(u => u.RoleName).NotEmpty().WithMessage("请填写角色名称").When(r=>r.RoleId == Guid.Empty);
            });

            RuleSet("Update", () =>
            {
                RuleFor(u => u.RoleName).NotEmpty().WithMessage("请填写角色名称");
            });

            RuleSet("Delete", () =>
            {

            });
        }
    }
}
